#include <bits/stdc++.h>
using namespace std;

inline int read() {
	int x = 0, f = 0; char ch = getchar();
	while (ch < '0' or ch > '9') f |= (ch == '-'), ch = getchar();
	while (ch >= '0' and ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

int __stk[128], __top;
inline void write(int x) {
    if(x < 0) putchar('-'), x = -x;
	do { __stk[++__top] = x % 10, x /= 10; } while (x);
	while (__top) putchar(__stk[__top--] + '0');
}

const int mod = 1e9 + 7;

void Min(int &x, int y) { y < x and (x = y); }
void Max(int &x, int y) { y > x and (x = y); }

void inc(int &x, int y) { (x += y) >= mod and (x -= mod); }
void mul(int &x, int y) { x = 1ll * x * y % mod; }

int q_pow(int x, int k) { int res = 1; for (; k; k >>= 1, mul(x, x)) if (k & 1) mul(res, x); return res; }

bool stmer;

const int N = 610, M = 300;

int n, m, ans;
int fac[N], inv[N], a[N];

int f[N], g[N], h[N];

char s[N];

void init() {
    fac[0] = 1;
    for (int i = 1; i < N; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
    inv[N - 1] = q_pow(fac[N - 1], mod - 2);
    for (int i = N - 1; i; i--) inv[i - 1] = 1ll * inv[i] * i % mod;
}

void work(int x) {
    int cnt = 0; bool flag = 0;
    for (int i = 1; i <= n; i++) {
        a[i] = s[i] == '(' ? 1 : -1;
        if (s[i] == 'x') a[i] = x & 1 ? 1 : -1, x >>= 1;
        f[i] = f[i - 1] + a[i], flag |= f[i] < 0;
    }

    if (!flag) return ans++, void();

    int mx = 0, p = 1;
    while (f[p] >= 0) max(mx, f[p++]); 
    int pos = p; g[p - 1] = 0;
    while (p <= n) g[p] = max(g[p - 1], f[p]), p++;

    cnt = 0;
    for (int i = n; i and flag and cnt >= 0; i--) {
        int d = f[n] / 2 - f[i]; cnt -= a[i];
        if (d < 0 or d > mx or g[i] > 2 * d) continue;
        flag = 0;
    }

    return ans += flag ^ 1, void();
}

bool edmer;
signed main() {
	freopen("bracket.in", "r", stdin);
	freopen("bracket.out", "w", stdout);
	cerr << "[Memory] " << (&stmer - &edmer) / 1024 / 1024 << " MB\n";
	
    n = read(), scanf("%s", s + 1);
    for (int i = 1; i <= n; i++) m += s[i] == 'x';

    if (n & 1) puts("0"), exit(0);
    for (int i = 0; i < 1 << m; i++) work(i);
    
    write(ans), putchar('\n');

    cerr << "[Runtime] " << (double) clock() / CLOCKS_PER_SEC << " seconds\n";
	return 0;
} 